fix(NODE-4763): tryNext not updating resumeToken for a returned update#4587
Closed
Omnicpie wants to merge 2 commits intomongodb:mainfrom
Closed
fix(NODE-4763): tryNext not updating resumeToken for a returned update#4587Omnicpie wants to merge 2 commits intomongodb:mainfrom
Omnicpie wants to merge 2 commits intomongodb:mainfrom
Conversation
Contributor
|
Hi @Omnicpie, thanks for the submission. Your right - this fix will need testing. We likely needs tests to confirm that the tryNext() correctly updates the resume token both when there is a document and there is not a document, for both the inital change stream aggregates and subsequent getMores. We have a lot of change stream tests in change_stream.test.ts - if you look at the tests in that file, that should help get you going in the right direction! Also note that |
Contributor
|
Fixed in #4636 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR attempts to fix an issue noticed when using
tryNextin which it does not correctly update the resumeToken when updates are received, meaning that if the change stream is resumed it can end up resuming in the past, causing issues.What is changing?
The change is small and involves changing the
tryNextfunction to use the internal_processChangefunction which handles updating the resume token before returning the given change. This is used bynextalready, so seems to be a good solution overall.What is the motivation for this change?
To prevent issues where resuming the change-stream using
tryNextcauses the client to go backwards in time, potentially causing issues on systems that use this functionalityNOTE FOR REVIEWERS
I wasn't sure where to add test coverage for this, or what exactly I should call in terms of testing, Happy to add some tests for this functionality if someone can point me in the right direction of the "where and how" to test this.
Double check the following
npm run check:lintscripttype(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript